import { missContentWriteToFile } from './common.js'
import { getCurFilePath } from './formatFile.js'

export const formatMixin = (str) => {
  if (!str) return ''
  const formattedStr = str.replace(/^mixins:\s?\[(.*?)\]\s*?$/g, '$1')
  const mixinsList = formattedStr
    .split(',')
    .map((item) => item.trim())
    .filter((item) => item)
  if (mixinsList.length) {
    const err = {
      path: getCurFilePath(),
      mixinsList,
      reason: 'mixins',
      section: 'mixins',
    }
    missContentWriteToFile(JSON.stringify(err))
  }
  return ''
}
